package example.controller;

import example.aop.NewExpResponse;
import example.constant.ResponseEnum;
import example.handler.NormalUserHandler;
import example.param.NormalUserDeleteParam;
import example.param.NormalUserEditParam;
import example.param.NormalUserLoginParam;
import example.param.NormalUserSignInParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by snksnk1091 on 2017/8/23.
 */
@Controller
@RequestMapping("/NormalUser")
public class NormalUserController {

    @Autowired
    private NormalUserHandler normalUserHandler;

    @ResponseBody
    @NewExpResponse
    @RequestMapping("/normalUserSignIn")
    public Object normalUserSignIn(@RequestBody NormalUserSignInParam param){
        normalUserHandler.normalUserSignIn(param);
        return ResponseEnum.SUCCESS;
    }

    @ResponseBody
    @NewExpResponse
    @RequestMapping("/normalUserEdit")
    public Object normalUserEdit(@RequestBody NormalUserEditParam param){
        normalUserHandler.normalUserEdit(param);
        return ResponseEnum.SUCCESS;
    }

    @ResponseBody
    @NewExpResponse
    @RequestMapping("/normalUserDelete")
    public Object normalUserDelete(@RequestBody NormalUserDeleteParam param){
        normalUserHandler.normalUserDelete(param);
        return ResponseEnum.SUCCESS;
    }

    @ResponseBody
    @NewExpResponse
    @RequestMapping("/getNormalUser/{id}")
    public Object getNormalUser(@PathVariable int id){
        return normalUserHandler.getNormalUser(id);
    }

    @ResponseBody
    @NewExpResponse
    @RequestMapping("/normalUserLogin")
    public Object normalUserLogin(@RequestBody NormalUserLoginParam param){
        return normalUserHandler.normalUserLogin(param);
    }
}
